<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,Chrome=1,IE=9">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="LEUR DE CHINE">
    <meta name="keywords"
          content="china reds,china blues,cashmere,corduroy,little bag,tartans,tweeds,stars,stripes,linen,leather,tassel travel bag,tartan,accessories">
    <title>上药神象农业物联网监控系统</title>
    <!--[if lte IE 8]>
    <script>window.location.href = 'http://cdn.dmeng.net/upgrade-your-browser.html?referrer=' + location.href;</script>
    <![endif]-->
    <script type="text/javascript" src="${basePath}/pc/lib/respond/respond.src.js"></script>
    <link href="${basePath}/pc/lib/bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <link href="${basePath}/pc/css/font-awesome.min.css" rel="stylesheet">
    <link href="${basePath}/pc/lib/iconfont/css/iconfont.css" rel="stylesheet">
    <link href="${basePath}/pc/css/main.css" rel="stylesheet">
    <!--[if lt IE 9]>
    <script src="${basePath}/pc/lib/bootstrap/js/html5shiv.min.js"></script>
    <script src="${basePath}/pc/lib/bootstrap/js/respond.min.js"></script>
    <![endif]-->
</head>

<body>
<div class="wrp">
    <div class="lgn_o">
        <div class="lgn_m">
            <div class="cnt">
                <h1 class="logo"><img src="${basePath}/pc/img/logo.png" class="img-responsive" alt="神象物联网监控系统"></h1>
                <div class="pl">
                    <div class="pdg">
                        <h2 class="frm_tit">新用户注册</h2>
                        <form class="form-horizontal">
                            <div class="form-group">
                                <div class="input-group">
                                    <div class="input-group-addon"><span class="fnt">手机号&nbsp;&nbsp;&nbsp;</span></div>
                                    <input type="text" class="form-control input-lg" name="phone" placeholder="请输入手机号">
                                </div>
                            </div>
                            <!--form-group end-->
                            <div class="form-group">
                                <div class="input-group">
                                    <div class="input-group-addon"><span class="fnt">密&nbsp;&nbsp;&nbsp;码</span></div>
                                    <input type="password" class="form-control input-lg" name="password"
                                           placeholder="请输入密码">
                                </div>
                            </div>

                            <div class="form-group">
                                <div class="input-group">
                                    <div class="input-group-addon"><span class="fnt">密&nbsp;&nbsp;&nbsp;码</span></div>
                                    <input type="password" class="form-control input-lg" name="confirmPassword"
                                           placeholder="请再次输入密码">
                                </div>
                            </div>
                            <!--form-group end-->

                            <div class="form-group">
                                <div class="input-group">
                                    <div class="input-group-addon"><span class="fnt">验证码&nbsp;&nbsp;&nbsp;</span></div>
                                    <input type="text" class="form-control input-lg" name="code" placeholder="请输入验证码">
                                    <div class="input-group-addon yz_btn">点击发送</div>
                                </div>
                            </div>
                            <!--form-group end-->
                            <div class="form-group frm_btn">
                                <button type="button" class="col-xs-5 btn btn-lg lg_btn">提交</button>
                                <button type="button" class="goback col-xs-5 col-xs-offset-2 btn btn-lg lg_btn">返回
                                </button>
                            </div>
                            <!--form-group end-->
                        </form>
                        <!--form-horizontal end-->
                    </div>
                    <!--pdg end-->
                </div>
                <!--lgn_pl end-->
            </div>
            <!--cnt end-->
            <footer class="ftr">Copyright<span class="cpy">&copy;</span>2017 上海上药神象健康药业有限公司</footer>
        </div>
        <!--lgn_m end-->
    </div>
    <!--lgn_o end-->
</div>
<!--wrp end-->
<script src="${basePath}/pc/lib/jquery/jquery.min.js"></script>
<script src="${basePath}/pc/lib/bootstrap/js/bootstrap.min.js"></script>
<script src="${basePath}/common/js/common.js"></script>
<script src="${basePath}/common/js/ajax.js"></script>
<script src="${basePath}/common/js/form.js"></script>
<script>
    $(document).ready(function () {
        $(".goback").click(function () {
            window.location.href = "${basePath}/pc/user/login";
        });
        $(".yz_btn").click(send);

        function send() {
            if (!checkMobile($('[name="phone"]').val())) {
                alert("请输入正确的手机号");
                return false;
            }
            AsyncPost("${basePath}/pc/user/sendSmsCode", {phone: $('[name="phone"]').val()}, function (value) {
                if (value.code == 0) {
                    var time = 60;
                    var interval = setInterval(function () {
                        $(".yz_btn").text(time--);
                        if (time == 0) {
                            $(".yz_btn").text("点击发送");
                            $(".yz_btn").click(send);
                            clearInterval(interval);
                        } else {
                            $(".yz_btn").unbind("click");
                        }
                    }, 1000);
                } else {
                    alert(value.msg);
                }
            });
        }

        $(".frm_btn button:first").click(function () {
            AsyncPost("${basePath}/pc/user/register", getFormData($("form")), function (value) {
                if (value.code == 0) {
                    alert(value.msg + ",即将跳到登录页面进行登录");
                    window.location.href = "${basePath}/function/pc/map";
                } else {
                    alert(value.msg);
                }
            })
        });
    });
</script>
</body>
</html>